import { Inject, Controller, Post, Body } from '@midwayjs/core';
import { Context } from '@midwayjs/koa';
import { ApiService } from '../service/api.service';


@Controller('/api')
export class APIController {
  @Inject()
  ctx: Context;

  @Inject()
  ApiService: ApiService;

  @Post("/getindex")
  async getindex(@Body() data:any  ){
    console.log(data.id);
    
    let result = await this.ApiService.getindex()
    //  console.log(result);
    return { 
      code:2000 ,
      data:result
     }
  }


  @Post("/getmodel")
  async getmodel(@Body() data:any  ){
    console.log(data.id);
    
    let result = await this.ApiService.getmodel(data.id,data.page ,data.pageSize)
    //  console.log(result);
    return { 
      code:2000 ,
      data:result
     }
  }
  @Post("/detailid")
  async getdetail(@Body() data:any  ){
    console.log(data.id);
    
    let result = await this.ApiService.getdetail(data.id,data.detailid)
     console.log(result);
    return { 
      code:2000 ,
      data:result
     }
  }

}
